<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

  <style>
    fdfsd {
      color: red;
      font-size: 12px;

    }
  </style>

</head>
<body>
<!-- span  任意单词   开发  span   -->
<h1>软件测试 <fdfsd>提示</fdfsd> </h1>

<form action="">

  <p>
    用户名：
    <input type="text" name="username" onblur="test()"/>
    <span id="s"></span>

  </p>

</form>

<script>

  function test() {
    let username = document.getElementsByName('username');

    if (username.length > 0) {
      var s = document.getElementById('s');
      s.innerText = 'YES！';
    } else {
      var s = document.getElementById('s');
      s.innerText = '请输入';
    }

  }

</script>


</body>
</html>